{% extends "base.html" %}
{% load static %}

{% block title %} Forgot Password {% endblock %}

{% block nav %}
<nav class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top">
    <a class="navbar-brand" href="{% url 'yaksh:index' %}">
        <img src="{% static 'yaksh/images/yaksh_banner.png' %}" alt="YAKSH">
    </a>
</nav>
{% endblock %}

{% block script %}
<script type="text/javascript">
    $(document).ready(function()
    {
        $("#id_new_password1").addClass("form-control");
        $("#id_new_password2").addClass("form-control");
    });
</script>
{% endblock %}

{% block content %}
<br><br>
<center><h4>Reset Password</h4>
    <div class="container col-md-6">
    {% if validlink %}
        <p>Please enter your new password twice so we can verify you typed it in correctly
        </p>.
        <form method="post">
            {% csrf_token %}
            <table class="table table-responsive-sm">
                {% if form.errors %}
                    {% for field in form %}
                        {% for error in field.errors %}
                            <div class="alert alert-dismissible alert-danger">
                                <button type="button" class="close" data-dismiss="alert">
                                    <i class="fa fa-close"></i>
                                </button>
                                <strong>{{ error|escape }}</strong>
                            </div>
                        {% endfor %}
                    {% endfor %}
                    {% for error in form.non_field_errors %}
                        <div class="alert alert-dismissible alert-danger">
                            <button type="button" class="close" data-dismiss="alert">
                                <i class="fa fa-close"></i>
                            </button>
                            <strong>{{ error|escape }}</strong>
                        </div>
                    {% endfor %}
                {% endif %}
                {% for field in form %}
                  <tr>
                    <td>{{ field.label }}</td>
                    <td>{{ field }} <small>{{ field.help_text }}</small></td>
                  </tr>
                {% endfor %}
            </table>
            <button class= "btn btn-success btn-lg" type="submit">Submit</button>
        </form>
    {% else %}
        <p>This reset link is no longer valid!</p>
    {% endif %}
    </div>
</center>
{% endblock %}
